const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    name: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "名称",
      field: "name"
    },
    code: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "编号",
      field: "code"
    },
    pcode: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "养殖场编号",
      field: "pcode"
    },
    product: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "养殖产品名称",
      field: "product"
    },
    scale: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "养殖规模",
      field: "scale"
    },
    mode: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "养殖模式",
      field: "mode"
    },
    fig: {
      type: DataTypes.STRING(32),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "养殖单元照片",
      field: "fig"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,
 
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,
 
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "farm_unit_info",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const FarmUnitInfoModel = sequelize.define("farm_unit_info_model", attributes, options);
  return FarmUnitInfoModel;
};